package com.org.redis.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import redis.clients.jedis.HostAndPort;
import redis.clients.jedis.JedisCluster;

import java.util.HashSet;

/**
 * jedis集群配置
 * @author wang
 */
@Configuration
public class JedisClusterConfig {

    @Bean
    public JedisCluster jedisCluster(){
        HashSet<HostAndPort> cluster = new HashSet<>();
        cluster.add(new HostAndPort("134.175.117.176",7001));
        cluster.add(new HostAndPort("134.175.117.176",7002));
        cluster.add(new HostAndPort("134.175.117.176",7003));
        cluster.add(new HostAndPort("134.175.117.176",7004));
        cluster.add(new HostAndPort("134.175.117.176",7005));
        cluster.add(new HostAndPort("134.175.117.176",7006));
        JedisCluster jedisCluster = new JedisCluster(cluster);
        return jedisCluster;
    }
}
